package cn.holy.app.xcddt.database.dao;

import androidx.lifecycle.LiveData;
import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.Query;
import androidx.room.Update;

import java.util.List;

import cn.holy.app.xcddt.domain.RecordUserBean;

import static androidx.room.OnConflictStrategy.REPLACE;

/**
 * Created by xionghao-mbp on 2018/3/26.
 */

@Dao
public interface RecordUserDao {
    @Insert(onConflict = REPLACE)
    void save(RecordUserBean recordUserBean);

    @Query("select * from record_users order by create_at desc")
    LiveData<List<RecordUserBean>> loadRecordUsers();

    @Query("select * from record_users where `select` = 1 order by create_at desc")
    LiveData<List<RecordUserBean>> loadSelectUsers();
    @Update
    void updateUser(RecordUserBean userBean);

    @Delete
    void delete(RecordUserBean recordUserBean);

    @Delete
    void deleteByUsers(List<RecordUserBean> userBeans);


}

